//获取应用实例
const app = getApp();

Page({
	data: {
    nameId:'',//姓名
  },
	onLoad: function() {},

  nameInput: function (e) {
    var that = this;
    that.setData({
      nameId: e.detail.value
    })
  },

  //编辑用户信息
  editMsg:function(){
    var that=this;
    if(that.data.nameId.length==0){
      wx.showToast({
        title: '请输入昵称',
        icon:'none'
      })
      return;
    }
    wx.request({
      url: app.globalData.api + '/index.php/wap/User/editMsg',
      data: {
        token: app.globalData.token,
        nickname:that.data.nameId,
      },
      headers: {
        'platform': '' + app.globalData.platform,
        'version': '' + app.globalData.version,
      },
      method: 'POST',
      dataType: 'json',
      success(res) {
        console.log(res)
        wx.navigateBack({
          delta:1
        })
      }
    })
  },
});
